//package com.example.bsxk.security;
//
//import com.example.bsxk.dto.BaseResponse;
//import com.fasterxml.jackson.databind.ObjectMapper;
//import org.springframework.security.core.Authentication;
//import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
//import org.springframework.stereotype.Component;
//
//import javax.servlet.ServletException;
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import java.io.IOException;
//
//@Component
//public class BsxtAuthenticationSuccessHandler implements AuthenticationSuccessHandler {
//    @Override
//    public void onAuthenticationSuccess(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Authentication authentication) throws IOException, ServletException {
//        BaseResponse baseResponse = new BaseResponse();
//        baseResponse.setCode("0");
//        baseResponse.setMessage("登陆成功");
//        //转JSON数据
//        ObjectMapper objectMapper = new ObjectMapper();
//        String result = objectMapper.writeValueAsString(baseResponse);
//        httpServletResponse.setContentType("application/json;charset=utf-8");
//        //响应给浏览器
//        httpServletResponse.getWriter().write(result);
//    }
//}
